EventQuery Methods
The EventQuery object contains the following methods:
Note: Some of the examples in this topic use the WScript.Sleep statement, which is not available for use when scripting in CygNet Studio. Use TheView's EventTimer instead.
CancelEventFiltering
The CancelEventFiltering method cancels any event filtering that might be in progress and clears any stored query results. The queries (filters) themselves are not destroyed.
Syntax
CancelEventFiltering()
Example
The following example prepares for a change in the query filters by first canceling any in-progress filtering operations and clearing any stored query results.
Sub
'Changing event filters
EventQuery.CancelEventFiltering()
Call MyUpdateEventFilter()
EventQuery.StartEventFiltering()
End Sub
ClearQueryResults
The ClearQueryResults method clears the results of a previous query and initializes the processing flags. The queries (filters) themselves are not destroyed.
Syntax
ClearQueryResults()
Remark
Clearing the results of a previously completed query is required when the results are being refreshed on an update interval so that the next batch of events can be retrieved.
Example
The following example demonstrates clearing the query results after retrieving results from one successful filter operation before the next filter operation executes.
Sub
Call MyUpdateEventFilter()
EventQuery.StartEventFiltering()
'query is all set up and retrieving events
While g_objEventQuery.IsEventFilterFiltering()
If Not g_objEventQuery.IsQueryComplete() then
WScript.Sleep(1000)
Else
'the query has completed an update process so retrieve the data
Call MyDataRetrieval()
'now clear these results so the next batch can be retrieved
EventQuery.ClearQueryResults()
End If
Wend
End Sub
CreateEventFilter
The CreateEventFilter method creates a new event filter thread.
Syntax
CreateEventFilter(StartTime As Date, EndTime As Date, UpdateInterval As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
StartTime |
Yes |
The earliest date/time of events to be filtered. Note that this value can either be a string in the machine-chosen date/time format (i.e. 'MM/DD/YY hh:mm:ss' for a machine using the American date/time format), or it can be a Date returned from the CDate function. |
|
EndTime |
Yes |
The latest date/time of events to be filtered. Note that this value can either be a string in the machine-chosen date/time format (i.e. 'MM/DD/YY hh:mm:ss' for a machine using the American date/time format), or it can be a Date returned from the CDate function. |
|
UpdateInterval |
Yes |
The periodic run interval in seconds. If this value is zero, the query will only run once. |
Remark
Call StartEventFiltering after creating a filter in order to start the event retrieval process.
Example
The following example goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
Sub
'-----------------SETUP------------------
Dim date1, date2
date1 = Date - 10
date2 = Date
Dim startDate, endDate
startDate = CDate(date1)
endDate = CDate(date2)
'create event filter for events between now and 10 days ago with an UpdateInterval of zero instructing the query to only run once
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter(startDate, endDate, 0)
'initialize the filter
'set the service-specific filters from existing XMLs (see the documentation for 'SetAudFilterAsXml / SetElsAlmFilterAsXml / SetElsFilterAsXml for examples of 'XML filters)
Dim bSetAud
bSetAud = EventQuery.SetAudFilterAsXml(g_xmlAudFilter)
EventQuery.SetAudSiteServices("CYGDEMO.AUD;CYGDEMO.AUD1")
Dim bSetElsAlm
bSetElsAlm = EventQuery.SetElsAlmFilterAsXml(g_xmlElsAlmFilter)
EventQuery.SetElsAlmSiteServices("CYGDEMO.ELSALM;CYGDEMO.ELSALM1")
Dim bSetEls
bSetEls = EventQuery.SetElsFilterAsXml(g_xmlElsFilter)
EventQuery.SetElsSiteServices("CYGDEMO.ELS;CYGDEMO.ELS1")
'set notification point
EventQuery.SetNotificationPoint "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT"
'-----------------EXECUTION------------------
'start the filters
Call EventQuery.StartEventFiltering()
'check to see if filter has been set up and started correctly
if Not
EventQuery.IsEventFilterFiltering() then
Call EventQuery.DestroyEventFilter(100)
Exit Sub
End If
'wait for query completion
Dim iCnt : iCnt = 0
Dim bDone : bDone = False
While (Not bDone)
bDone = EventQuery.IsQueryComplete()
If( Not bDone) Then
'update process hasn't completed yet
iCnt = iCnt + 1
If( iCnt > 100 ) Then
'tired of waiting, clean up and exit
Call EventQuery.DestroyEventFilter(100)
Exit Sub
Else
WScript.Sleep(1000)
End if
End if
Wend
'-----------------RESULTS------------------
Dim strAudError, strElsAlmError, strElsError
Dim nSize, recKey, pvEventInfoXml, pvKeyList, iRec
'Aud
EventQuery.GetAudQueryError strAudError
EventQuery.GetFilteredAudListSize nSize
pvKeyList = ""
EventQuery.GetFilteredAudList pvKeyList
For iRec = 0 To nSize - 1
recKey = pvKeyList (iRec)
pvEventInfoXml = ""
EventQuery.GetAudEventInfoAsXml recKey, pvEventInfoXml
MsgBox pvEventInfoXml
Next
EventQuery.GetAudQueryError(strAudError)
'ElsAlm
EventQuery.GetElsAlmQueryError strElsAlmError
EventQuery.GetFilteredElsAlmListSize nSize
pvKeyList = ""
EventQuery.GetFilteredElsAlmList pvKeyList
For iRec = 0 To nSize - 1
recKey = pvKeyList (iRec)
pvEventInfoXml = ""
EventQuery.GetElsAlmEventInfoAsXml recKey, pvEventInfoXml
MsgBox pvEventInfoXml
Next
EventQuery.GetElsAlmQueryError(strElsAlmError)
'Els
EventQuery.GetElsQueryError strElsError
EventQuery.GetFilteredElsListSize nSize
pvKeyList = ""
EventQuery.GetFilteredElsList pvKeyList
For iRec = 0 To nSize - 1
recKey = pvKeyList (iRec)
pvEventInfoXml = ""
EventQuery.GetElsEventInfoAsXml recKey, pvEventInfoXml
MsgBox pvEventInfoXml
Next
EventQuery.GetElsQueryError(strElsError)
'event query is finished
EventQuery.DestroyEventFilter(100)
End Sub
DestroyEventFilter
The DestroyEventFilter method stops any background filter operations and clears all configured filters and pending results, and waits for the specified number of seconds for all operations to end.
Syntax
DestroyEventFilter(TimeToWaitInSeconds As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
TimeToWaitInSeconds |
Yes |
The number of seconds to wait for the destroy operation to complete. This value must be within the range [1 - 100]. |
Remark
This method will wait for the specified number of seconds while any background filter operations stop. If this process has not completed by the time the interval has expired, this method will return false. Call this method as part of the cleanup routine after querying is finished.
Example
The following example cleans up the query after it is finished, which stops any background filter operations and clears all configured filters and pending results.
FormatSiteServicePlusDbKey
The FormatSiteServicePlusDbKey method puts a Site.Service and a database key (DbKey) into the 'Site.Service+DbKey' format.
Syntax
FormatSiteServicePlusDbKey(SiteService As String, DbKey As String, SiteServiceDbKey As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteService |
Yes |
The Site.Service to be formatted. |
|
DbKey |
Yes |
The database key (DbKey) to be formatted. |
|
SiteServiceDbKey |
Yes |
The return value in the 'Site.Service+DbKey' format. |
Remark
This method returns false if one of the SiteService or DbKey parameters is invalid. To retrieve the constituent Site.Service and DbKey from a 'Site.Service+DbKey' string, use the ParseSiteServicePlusDbKey method.
Example
The following example formats a Site.Service and DbKey and displays the result, then parses the result back into its constituent parts, and displays them. The two outputs should be identical.
Sub
Dim strSiteService
strSiteService = "CYGDEMO.AUD"
Dim strDbKey
strDbKey = "0000006547C0000001A0000001"
Dim strSiteServiceDbKey
Dim bRet
bRet = EventQuery.FormatSiteServicePlusDbKey(strSiteService, strDbKey, strSiteServiceDbKey)
If (bRet) Then
MsgBox strSiteServiceDbKey
End If
bRet = EventQuery.ParseSiteServicePlusDbKey(strSiteServiceDbKey, strSiteService, strDbKey)
If (bRet) Then
MsgBox strSiteService + "+" + strDbKey
End If
End Sub
GetAudEventInfoAsXml
The GetAudEventInfoAsXml method returns event information for the given AUD Site.Service and database key (DbKey).
Syntax
GetAudEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The AUD Site.Service and The database key (DbKey) in the 'Site.Service+DbKey' format. |
|
EventInfoXml |
Yes |
The event information for the AUD Site Service returned as a string. |
Remark
After querying is complete, this method is used in conjunction with GetFilteredAudList to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetAudFilterAsXml
The GetAudFilterAsXml method returns the AUD event filter as an XML string.
Syntax
GetAudFilterAsXml(XmlFilter As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string returned from this method. |
Example
The following example sets the AUD event filter, then retrieves it from the query and displays it.
Sub
'set the service-specific filter from an existing XML (see the documentation for
'SetAudFilterAsXml for an example of an XML filter)
Dim bSetAud
bSetAud = EventQuery.SetAudFilterAsXml(g_xmlAudFilter)
Dim xmlAudFilter
If (bSetAud) Then
bGetAud = EventQuery.GetAudFilterAsXml(xmlAudFilter)
If (bGetAud) Then
MsgBox xmlAudFilter
End If
End If
End Sub
GetAudQueryError
The GetAudQueryError method returns the last error (if any) in the AUD query.
Syntax
GetAudQueryError(Error As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Error |
Yes |
The last error in the AUD query as a string. This value is an empty string if there is no error. |
Remark
This method returns true if there is an error in the AUD query, otherwise it returns false.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetElsAlmEventInfoAsXml
The GetAudQueryError method returns event information for the given ELSALM Site.Service and database key (DbKey).
Syntax
GetElsAlmEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The ELSALM Site.Service and The database key (DbKey) in the 'Site.Service+DbKey' format. |
|
EventInfoXml |
Yes |
The event information for the ELSALM Site Service returned as a string. |
Remark
After querying is complete, this method is used in conjunction with GetFilteredElsAlmList to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetElsAlmFilterAsXml
The GetElsAlmFilterAsXml method returns the ELSALM event filter as an XML string.
Syntax
GetElsAlmFilterAsXml(XmlFilter As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string returned from this method. |
Example
The following example sets the ELSALM event filter, then retrieves it from the query and displays it.
Sub
'set the service-specific filter from an existing XML (see the documentation for
'SetElsAlmFilterAsXml for an example of an XML filter)
Dim bSetElsAlm
bSetElsAlm = EventQuery.SetElsAlmFilterAsXml(g_xmlElsAlmFilter)
Dim xmlElsAlmFilter
If (bSetElsAlm) Then
bGetElsAlm = EventQuery.GetElsAlmFilterAsXml(xmlElsAlmFilter)
If (bGetElsAlm) Then
MsgBox xmlElsAlmFilter
End If
End If
End Sub
GetElsAlmQueryError
The GetElsAlmQueryError method returns the last error (if any) in the ELSALM query.
Syntax
GetElsAlmQueryError(Error As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Error |
Yes |
The last error in the ELSALM query as a string. This value is an empty string if there is no error. |
Remark
This method returns true if there is an error in the ELSALM query, otherwise it returns false.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetElsEventInfoAsXml
The GetElsEventInfoAsXml method returns event information for the given ELS Site.Service and database key (DbKey).
Syntax
GetElsEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The ELS Site.Service and The database key (DbKey) in the 'Site.Service+DbKey' format. |
|
EventInfoXml |
Yes |
The event information for the ELS Site Service returned as a string. |
Remark
After querying is complete, this method is used in conjunction with GetFilteredElsList to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetElsFilterAsXml
The GetElsFilterAsXml method returns the ELS event filter as an XML string.
Syntax
GetElsFilterAsXml(XmlFilter As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string returned from this method. |
Example
The following example sets the ELS event filter, then retrieves it from the query and displays it.
Sub
'set the service-specific filter from an existing XML (see the documentation for
'SetElsFilterAsXml for an example of an XML filter)
Dim bSetEls
bSetEls = EventQuery.SetElsFilterAsXml(g_xmlElsFilter)
Dim xmlElsFilter
If (bSetEls) Then
bGetEls = EventQuery.GetElsFilterAsXml(xmlElsFilter)
If (bGetEls) Then
MsgBox xmlElsFilter
End If
End If
End Sub
GetElsQueryError
The GetElsQueryError method returns the last error (if any) in the ELS query.
Syntax
GetElsQueryError(Error As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Error |
Yes |
The last error in the ELS query as a string. This value is an empty string if there is no error. |
Remark
This method returns true if there is an error in the ELS query, otherwise it returns false.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetFilteredAudList
The GetFilteredAudList method returns the list of filtered AUD events as Site.Service and database key (DbKey) pairs.
Syntax
GetFilteredAudList(SiteSvcKeyList As Array) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteSvcKeyList |
Yes |
A list of Site.Service and The database key (DbKey) database key (DbKey) pairs (in the 'Site.Service+DbKey' format) representing the filtered AUD events. |
Remark
After querying is complete, this method is used in conjunction with GetAudEventInfoAsXml to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetFilteredAudListSize
The GetFilteredAudListSize method returns the size of the filtered AUD event list as an integer
Syntax
GetFilteredAudListSize(Size As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Size |
Yes |
The size of the filtered AUD event list. |
Remark
The filtered AUD event list itself can be obtained via GetFilteredAudList.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetFilteredElsAlmList
The GetFilteredElsAlmList method returns the list of filtered ELSALM events as Site.Service and database key (DbKey) pairs.
Syntax
GetFilteredElsAlmList(SiteSvcKeyList As Array) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteSvcKeyList |
Yes |
A list of Site.Service and The database key (DbKey) pairs (in the 'Site.Service+DbKey' format) representing the filtered ELSALM events. |
Remark
After querying is complete, this method is used in conjunction with GetElsAlmEventInfoAsXml to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetFilteredElsAlmListSize
The GetFilteredElsAlmListSize method returns the size of the filtered ELSALM event list as an integer
Syntax
GetFilteredElsAlmListSize(Size As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Size |
Yes |
The size of the filtered ELSALM event list. |
Remark
The filtered ELSALM event list itself can be obtained via GetFilteredElsAlmList.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetFilteredElsList
The GetFilteredElsList method returns the list of filtered ELS events as Site.Service and database key (DbKey) pairs.
Syntax
GetFilteredElsList(SiteSvcKeyList As Array) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteSvcKeyList |
Yes |
A list of Site.Service and The database key (DbKey) pairs (in the 'Site.Service+DbKey' format) representing the filtered ELS events. |
Remark
After querying is complete, this method is used in conjunction with GetElsEventInfoAsXml to display the results of the query.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
GetFilteredElsListSize
The GetFilteredElsListSize method returns the size of the filtered ELS event list as an integer
Syntax
GetFilteredElsListSize(Size As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Size |
Yes |
The size of the filtered ELS event list. |
Remark
The filtered ELS event list itself can be obtained via GetFilteredElsList.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
IsEventFilterFiltering
The IsEventFilterFiltering method returns true if the entire query process has been set up and StartEventFiltering has been successfully called.
Syntax
IsEventFilterFiltering() As Boolean
Remark
This method will return true after a successful call to StartEventFiltering. Once the filtering has begun, this method will only return false if the filtering has been canceled using CancelEventFiltering, or if the filter has been destroyed using DestroyEventFilter.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
IsEventFilterRunning
The IsEventFilterFiltering method returns true if the event query thread is running.
Syntax
IsEventFilterRunning() As Boolean
Remark
The event query thread is executed after an event filter is created; therefore, after an event filter is created, this method will only return false if the filter has been destroyed using DestroyEventFilter or if the filter was created with an update interval of zero (meaning "run once") and the first and only data retrieval has completed.
Example
The following example creates an event filter, checks that it is running, destroys it, and checks that it is no longer running.
Sub
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter("10/1/2023", "10/4/2023", 5)
Dim bRunning
bRunning = EventQuery.IsEventFilterRunning()
MsgBox bRunning 'should be "True"
EventQuery.DestroyEventFilter(100)
bRunning = EventQuery.IsEventFilterRunning()
MsgBox bRunning 'should be "False"
End Sub
IsQueryComplete
The IsQueryComplete method returns true if all of the queries are no longer being executed.
Syntax
IsQueryComplete() As Boolean
Remark
This method will return true as long as any AUD, ELSALM, or ELS query is being executed. It will return false if all running queries fail when adding to the respective query cache, if the filter is destroyed using DestroyEventFilter, or if the previous query results are cleared using ClearQueryResults.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
ParseSiteServicePlusDbKey
The ParseSiteServicePlusDbKey method returns the Site.Service and database key (DbKey) elements from a 'Site.Service+DbKey'string.
Syntax
ParseSiteServicePlusDbKey(SiteServiceDbKey As String, SiteService As String, DbKey As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteServiceDbKey |
Yes |
The string to be parsed, in the 'Site.Service+DbKey' format. |
|
SiteService |
Yes |
The Site.Service parsed from SiteServiceDbKey. |
|
DbKey |
Yes |
The database key (DbKey) parsed from SiteServiceDbKey. |
Remark
This method returns false if one of the SiteService or DbKey parameters returned is invalid. This method does the reverse of the FormatSiteServicePlusDbKey method. To format a Site.Service and DbKey into a 'Site.Service+DbKey'string, use the FormatSiteServicePlusDbKey method.
Example
The following example formats a Site.Service and DbKey and displays the result, then parses the result back into its constituent parts, and displays them. The two outputs should be identical.
Sub
Dim strSiteService
strSiteService = "CYGDEMO.AUD"
Dim strDbKey
strDbKey = "0000006547C0000001A0000001"
Dim strSiteServiceDbKey
Dim bRet
bRet = EventQuery.FormatSiteServicePlusDbKey(strSiteService, strDbKey, strSiteServiceDbKey)
If (bRet) Then
MsgBox strSiteServiceDbKey
End If
bRet = EventQuery.ParseSiteServicePlusDbKey(strSiteServiceDbKey, strSiteService, strDbKey)
If (bRet) Then
MsgBox strSiteService + "+" + strDbKey
End If
End Sub
SetAudFilterAsXml
The SetAudFilterAsXml method sets the AUD event filter from an XML string.
Syntax
SetAudFilterAsXml(XmlFilter As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the AUD event filter to be set. |
Remark
This method returns false if the XML filter is invalid.
Example
The following is an example of an XML AUD event filter.
<ExportedRules ruleDataIdentifier='AUD Rules'>
<Rules enabled='true' inverted='false' op='1' name=''>
<Rule enabled='true' name='' referenceAttr='0' compareToType='0' externalData='' value='CXEVENTIF_OPID' operator='=' qualifer='Case Insensitive'>
<compareItem property='AuditOpId' type='0' />
</Rule>
<Rule enabled='true' name='' referenceAttr='0' compareToType='0' externalData='' value='FAC' operator='=' qualifer='Case Insensitive'>
<compareItem property='AudItemCat' type='0' />
</Rule>
<Rule enabled='true' name='' referenceAttr='0' compareToType='0' externalData='' value='CXEVENTIF_FAC_E' operator='=' qualifer='Case Insensitive'>
<compareItem property='AudItemId' type='0' />
</Rule>
</Rules>
</ExportedRules>
Note:
The XML for the filter rule uses the spelling "qualifer=" rather than "qualifier=". See Adding Filter Rule Definitions for an explanation of this discrepancy.
This filter will select all AUD events for which (Audit Operation ID = "CXEVENTIF_OPID" AND Audit Item Category = "FAC" AND Audit Item ID = "CXEVENTIF_FAC_E"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of AUD XML property names, see AUD XML Properties.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
SetAudMaxCacheSize
The SetAudMaxCacheSize method sets the maximum size of the AUD query cache.
Syntax
SetAudMaxCacheSize(MaxSize As Long) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
MaxSize |
Yes |
A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000. |
Remark
This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.
Example
The following example creates an event filter and sets the maximum AUD cache size to 50,000 before executing the query.
Sub
'create event filter
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter("10/1/2023", "10/4/2023", 5)
'initialize the filter (this step is necessary)
EventQuery.ClearQueryResults
EventQuery.SetAudMaxCacheSize 50000
'finish initializing and execute query
End Sub
SetAudPersistHours
The SetAudPersistHours method sets the amount of time (in hours) that the AUD query cache will persist.
Syntax
SetAudPersistHours(Hours As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Hours |
Yes |
The number of hours the AUD query cache will persist. This value must be between 0 and 100. |
Remark
This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.
Example
The following example creates an event filter and sets the AUD cache persist hours to 50 before executing the query.
Sub
'create event filter
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter("10/1/2023", "10/4/2023", 5)
'initialize the filter (this step is necessary)
EventQuery.ClearQueryResults
EventQuery.SetAudPersistHours 50
'finish initializing and execute query
End Sub
SetAudSiteServices
The SetAudSiteServices method defines the list of AUD site services for the AUD event filter.
Syntax
SetAudSiteServices(SiteServices As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteServices |
Yes |
A semicolon-delimited list of AUD Site.Services (for example, "CYGDEMO.AUD;CYGDEMO.AUD1") |
Remark
This method will only return false if a filter has not yet been created.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
SetElsAlmFilterAsXml
The SetElsAlmFilterAsXml method sets the ELSALM event filter from an XML string.
Syntax
SetElsAlmFilterAsXml(XmlFilter As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the ELSALM event filter to be set. |
Remark
This method returns false if the XML filter is invalid.
Example
The following is an example of an XML ELSALM event filter.
<ExportedRules ruleDataIdentifier='ELSALM Event Rules'>
<Rules enabled='true' inverted='false' op='1' name=''>
<Rule enabled='true' name='' referenceAttr='0' compareToType='0' externalData='' value='CxEventIf_ElsAlmTest' operator='=' qualifer='Case Insensitive'>
<compareItem property='Source' type='0' />
</Rule>
<Rule enabled='true' name='' referenceAttr='0' compareToType='0' externalData='' value='SET' operator='=' qualifer='Case Insensitive'>
<compareItem property='Category' type='0' />
</Rule>
</Rules>
</ExportedRules>
Note:
The XML for the filter rule uses the spelling "qualifer=" rather than "qualifier=". See Adding Filter Rule Definitions for an explanation of this discrepancy.
This filter will select all ELSALM events for which (ELS Source = "CXEVENTIF_OPID" AND ELS Category = "CONTROL"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of ELSALM XML property names, see ELSALM XML Properties.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
SetElsAlmMaxCacheSize
The SetElsAlmMaxCacheSize method sets the maximum size of the ELSALM query cache.
Syntax
SetElsAlmMaxCacheSize(MaxSize As Long) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
MaxSize |
Yes |
A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000. |
Remark
This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.
Example
The following example creates an event filter and sets the maximum ELSALM cache size to 50,000 before executing the query.
Sub
'create event filter
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter("10/1/2023", "10/4/2023", 5)
'initialize the filter (this step is necessary)
EventQuery.ClearQueryResults
EventQuery.SetElsAlmMaxCacheSize 50000
'finish initializing and execute query
End Sub
SetElsAlmPersistHours
The SetElsAlmPersistHours method sets the amount of time (in hours) that the ELSALM query cache will persist.
Syntax
SetElsAlmPersistHours(Hours As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Hours |
Yes |
The number of hours the ELSALM query cache will persist. This value must be between 0 and 100. |
Remark
This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.
Example
The following example creates an event filter and sets the ELSALM cache persist hours to 50 before executing the query.
Sub
'create event filter
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter("10/1/2023", "10/4/2023", 5)
'initialize the filter (this step is necessary)
EventQuery.ClearQueryResults
EventQuery.SetElsAlmPersistHours 50
'finish initializing and execute query
End Sub
SetElsAlmSiteServices
The SetElsAlmSiteServices method defines the list of ELSALM site services for the ELSALM event filter.
Syntax
SetElsAlmSiteServices(SiteServices As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteServices |
Yes |
A semicolon-delimited list of Site.Services (for example, "CYGDEMO.ELSALM;CYGDEMO.ELSALM1") |
Remark
This method will only return false if a filter has not yet been created.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
SetElsFilterAsXml
The SetElsFilterAsXml method sets the ELS event filter from an XML string.
Syntax
SetElsFilterAsXml(XmlFilter As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
XmlFilter |
Yes |
The XML string representing the ELS event filter to be set. |
Remark
This method returns false if the XML filter is invalid.
Example
The following is an example of an XML ELS event filter.
<ExportedRules ruleDataIdentifier='ELS Event Rules'>
<Rules enabled='true' inverted='false' op='1' name=''>
<Rule enabled='true' name='' referenceAttr='0' compareToType='0' externalData='' value='CxEventIf_ElsTest' operator='=' qualifer='Case Insensitive'>
<compareItem property='Source' type='0' />
</Rule>
<Rule enabled='true' name='' referenceAttr='0' compareToType='0' externalData='' value='CONTROL' operator='=' qualifer='Case Insensitive'>
<compareItem property='Category' type='0' />
</Rule>
</Rules>
</ExportedRules>
Note:
The XML for the filter rule uses the spelling "qualifer=" rather than "qualifier=". See Adding Filter Rule Definitions for an explanation of this discrepancy.
This filter will select all ELS events for which (ELS Source = "CXEVENTIF_OPID" AND ELS Category = "CONTROL"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of ELS XML property names, see ELS XML Properties.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
SetElsMaxCacheSize
The SetElsMaxCacheSize method sets the maximum size of the ELS query cache.
Syntax
SetElsMaxCacheSize(MaxSize As Long) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
MaxSize |
Yes |
A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000. |
Remark
This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.
Example
The following example creates an event filter and sets the maximum ELS cache size to 50,000 before executing the query.
Sub
'create event filter
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter("10/1/2023", "10/4/2023", 5)
'initialize the filter (this step is necessary)
EventQuery.ClearQueryResults
EventQuery.SetElsMaxCacheSize 50000
'finish initializing and execute query
End Sub
SetElsPersistHours
The SetElsPersistHours method sets the amount of time (in hours) that the ELS query cache will persist.
Syntax
SetElsPersistHours(Hours As Integer) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Hours |
Yes |
The number of hours the ELS query cache will persist. This value must be between 0 and 100. |
Remark
This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.
Example
The following example creates an event filter and sets the ELS cache persist hours to 50 before executing the query.
Sub
'create event filter
Dim bCreatedOk
bCreatedOk = EventQuery.CreateEventFilter("10/1/2023", "10/4/2023", 5)
'initialize the filter (this step is necessary)
EventQuery.ClearQueryResults
EventQuery.SetElsPersistHours 50
'finish initializing and execute query
End Sub
SetElsSiteServices
The SetElsSiteServices method defines the list of ELS site services for the ELS event filter.
Syntax
SetElsSiteServices(SiteServices As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
SiteServices |
Yes |
A semicolon-delimited list of Site.Services (for example, "CYGDEMO.ELS;CYGDEMO.ELS1") |
Remark
This method will only return false if a filter has not yet been created.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
SetNotificationPoint
The SetNotificationPoint method sets the CVS point which will contain a notification of when the queries have completed.
Syntax
SetNotificationPoint(Tag As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The CVS tag of the point to be used for notifications (for example, "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT"). |
Remark
This method will return false if the specified tag is invalid. Note that this method does not actually create a CVS point. A CVS point with the specified tag must exist prior to starting event filtering in order for CVS notifications to succeed.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.
StartEventFiltering
The StartEventFiltering method initiates event filtering on the background thread.
Syntax
StartEventFiltering() As Boolean
Remark
This method returns false if no event filter has been created.
Example
See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.


